﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CCWin;

namespace weiqijiance.安检仪表
{
    public partial class yibiaobass :Form
    {
        public yibiaobass()
        {
            InitializeComponent();
        }

        public void szct(Form f, TabPage p)
        {
            f.Dock = DockStyle.Fill;
            f.FormBorderStyle = FormBorderStyle.None;//去掉边框
            f.TopLevel = false;
            f.Parent = p;
            p.Tag = f;
            f.Show();
        }
        public bool bAP = false;
        public bool bBR = false;
        public bool bFL = false;
        public bool bWE = false;
        public bool bLI = false;
        public bool bSL = false;
        public bool bSP = false;
        public bool bSU = false;
        public bool bDLX = false;
        public bool bYH = false;
        public bool bzbzl = false;


        public TESTDLX f1;
        public TESTYH f2;
        public TESTSP f3;
        public TESTAP f4;
        public TESTLI f5;
        public TESTSL f6;
        public TESTWE f7;
        public TESTBR f8;
        public TESTFL f9;
        public TESTSU f10;
        public diaodu f11 = new diaodu();
        public TESTZBZL f12;
        private void yibiaobass_Load(object sender, EventArgs e)
        {
            tabControl1.SizeMode = TabSizeMode.Fixed;
            tabControl1.ItemSize = new Size(0, 1);
            if (bDLX)
            {
                szct(f1, tabPage1);
            }
            else
            {
                tabPage1.Parent = null;
            }
            if (bYH)
            {
                szct(f2, tabPage2);
            }
            else
            {
                tabPage2.Parent = null;
            }
            if (bSP)
            {
                szct(f3, tabPage3);
            }
            else
            {
                tabPage3.Parent = null;
            }
            if (bAP)
            {
                szct(f4, tabPage4);
            }
            else
            {
                tabPage4.Parent = null;
            }
            if (bLI)
            {
                szct(f5, tabPage5);
            }
            else
            {
                tabPage5.Parent = null;
            }
            if (bSL)
            {
                szct(f6, tabPage6);
            }
            else
            {
                tabPage6.Parent = null;
            }
            if (bWE)
            {
                szct(f7, tabPage7);
            }
            else
            {
                tabPage7.Parent = null;
            }
            if (bBR)
            {
                szct(f8, tabPage8);
            }
            else
            {
                tabPage8.Parent = null;
            }
            if (bFL)
            {
                szct(f9, tabPage9);
            }
            else
            {
                tabPage9.Parent = null;
            }
            if (bSU)
            {
                szct(f10, tabPage10);
            }
            else
            {
                tabPage10.Parent = null;
            }
            if (bzbzl)
            {
                szct(f12, tabPage12);
            }
            else
            {
                tabPage12.Parent = null;
            }
            szct(f11, tabPage11);
        }
        TabPage tabex = new TabPage();
        private delegate void FlushClient();//代理
        private void xianshi()
        {
            if (this.tabControl1.InvokeRequired)//等待异步
            {
                FlushClient fc = new FlushClient(xianshi);
                this.Invoke(fc);//通过代理调用刷新方法
            }
            else
            {
                tabControl1.SelectedTab = tabex;
            }
        }
        public void select(string name)
        {
            foreach (TabPage page in tabControl1.TabPages)
            {
                if (page.Text == name)
                {
                    //tabControl1.SelectedTab = page;
                    tabex = page;
                    xianshi();
                    break;
                }
            }
            //tabControl1.SelectedIndex = i;
        }
    }
}
